package function.Comparator;

import book.Book;

import java.util.Comparator;

public class PriceComparator implements Comparator<Book> {
    @Override
    public int compare(Book o1, Book o2) {
        double res = o1.getPrice() - o2.getPrice();
        if(res > 0){
            return 1;
        } else if (res == 0) {
            return 0;
        }else{
            return -1;
        }
    }
}
